package cn.jixie.MsgDispatcher;

import cn.jixie.model.TextMessage;
import cn.jixie.utils.MessageUtils;
import org.springframework.http.HttpRequest;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * @Auther: lzl
 * @Date: 18-10-25 11:51
 * @Description: 处理文本请求
 */
public class TextDispatcher {

    public static String processMessage(Map<String , String> map){
        TextMessage text = new TextMessage();
        //注意顺序不要弄反
        text.setFromUserName(map.get("ToUserName"));
        text.setToUserName(map.get("FromUserName"));

        text.setMsgType(map.get("MsgType"));
        text.setContent("java");
        text.setCreateTime(String.valueOf(System.currentTimeMillis()));

        return MessageUtils.textMessageToXml(text);

    }





















    /**
     * 回复关键字"1"的时候的内容
     *
     * @return
     */
    public static String inputNumber1() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("我是惊喜111，哈哈，惊喜不惊喜！");
        return stringBuilder.toString();
    }

    /**
     * 回复关键字"2"的时候的内容
     *
     * @return
     */
    public static String inputNumber2() {
        StringBuilder stringBuilder = new StringBuilder();
        stringBuilder.append("我是惊喜2222，哈哈，惊喜不惊喜！");
        return stringBuilder.toString();
    }


}
